const { ErrorModel } = require('../model/ResModel')
const { loginCheckFailInfo } = require('../model/ErrorInfo')

async function loginCheck(ctx, next) {
  if (ctx.session && ctx.session.user) {
    // 已登录
    await next()
    return
  }
  // 未登录
  ctx.body = new ErrorModel(loginCheckFailInfo)
}


module.exports = {
  loginCheck
}
